
class Animal {
    String name;
    int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public  void eat(){
//        System.out.println(this.name+);
        System.out.println(getName()+"吃");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

class Dog extends Animal implements IRun{

    public Dog(String name, int age) {
        super(name, age);
    }
    public  void eat(){
        System.out.println(getName()+"正在吃狗粮");

    }


    @Override
    public void run() {
        System.out.println(getName()+"摇着尾巴跑");
    }
}
class Bird extends Animal{

    public Bird(String name, int age) {
        super(name, age);
    }
    public void eat(){
        System.out.println(getName()+"正在吃鸟粮");
    }

}
public class Test {
    public static void Show(Animal animal){
        animal.eat();
    }
    public static void  run(IRun iRun){
        iRun.run();

    }
    public static void main(String[] args) {

        Show(new Bird("鸟",18));
        Show(new Dog("狗",19));
        run(new Dog("旺财",19));



    }
}
